package cn.com.pojo;

import java.sql.Types;

import javax.sql.DataSource;

import org.springframework.jdbc.core.SqlParameter;
import org.springframework.jdbc.object.SqlUpdate;

public class UpdatePerson extends SqlUpdate {
	public UpdatePerson(DataSource ds) {
		setDataSource(ds);
		setSql("update user set name = ? , desc1 = ? where id = ?");
		declareParameter(new SqlParameter(Types.VARCHAR));
		declareParameter(new SqlParameter(Types.VARCHAR));
		declareParameter(new SqlParameter(Types.INTEGER));
		compile();
	}

	public int run(Person person) {
		Object[] params = new Object[] { person.getName(), person.getDesc(), person.getId() };
		return update(params);
	}
}
